package com.xinzhi.savingpot.task.controller;

import com.xinzhi.savingpot.task.service.impl.TaskListServiceImpl;
import com.xinzhi.savingpot.util.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@Api("任务列表")
@RequestMapping("/taskList")
@CrossOrigin
public class TaskListController {
    @Autowired
    private TaskListServiceImpl listService;

    @ApiOperation("获取任务列表")
    @GetMapping("/queryTaskList")

    public BaseResponse TaskListPreheat() throws IOException {
        return listService.TaskListPreheat();
    }

    @ApiOperation("根据任务分类获取任务列表，每次拉取20条")
    @GetMapping("/queryTaskListByClassId")
    public BaseResponse queryTaskListByClassId(@RequestParam("taskClassId") Integer taskClassId) throws IOException {return listService.queryTaskListByClassId(taskClassId);}


    @ApiOperation("分页查询任务")
    @GetMapping("/pageTaskList")
    public BaseResponse pageTaskList(){
        return listService.taskSelectPage();
    }
}
